package com.ycl.bookstore.controller;

import com.ycl.bookstore.common.Result;
import com.ycl.bookstore.service.UserOrderService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/order")
public class UserOrderController {

    @Resource
    private UserOrderService userOrderService;

    @GetMapping("/list")
    public Result getUserOrderList(@RequestParam("pageNo") Long pageNo,
                                   @RequestParam("pageSize") Long pageSize,
                                   @RequestParam(value = "orderId",required = false) Long orderId ){
        return userOrderService.getUserOrderList(pageNo,pageSize,orderId);
    }

    @DeleteMapping("/delete/{orderId}")
    public Result deleteUserOrder(@PathVariable("orderId") Long orderId){
        return userOrderService.deleteUserOrder(orderId);
    }
}
